import ifmo.is.lab1.MyList;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.zip.DataFormatException;

public class Main 
{
	public static void main(String[] args) throws IOException 
	{
		BufferedReader in = null;
		PrintWriter out = null;
		try
		{
			if(args.length!=2) throw new DataFormatException("Input or output FileName is empty");
			in = new BufferedReader(new FileReader(args[0]));
			out = new PrintWriter(new FileWriter(args[1]));
			MyList List = new MyList();
			String s;
			while((s = in.readLine()) !=null)
			{
				String[] split = s.split(" ");
				switch(split[0])
				{
					case "add":
					{
						List.add(Integer.parseInt(split[1]));
						out.println("Ok");
						break;
					}
					case "get":
					{
						out.println(List.get(Integer.parseInt(split[1])));
						break;
					}
					case "remove":
					{
						List.remove(Integer.parseInt(split[1]));
						out.println("Ok");
						break;
					}
					case "removeFromCell":
					{
						List.removeFromCell(Integer.parseInt(split[1]));
						out.println("Ok");
						break;
					}
					case "isEmpty":
					{
						out.println(List.isEmpty());
						break;
					}
					case "size":
					{
						out.println(List.size());
						break;
					}
					case "clear":
					{
						List.clear();
						out.println("Ok");
						break;
					}
					case "indexOf":
					{
						out.println(List.indexOf(Integer.parseInt(split[1])));
						break;
					}
					case "toString":
					{
						out.println(List.toString());
						break;
					}
					default:
					{
						out.println("Unknown Command");
					}
				}
			}
		}
		catch (DataFormatException e)
		{
			e.printStackTrace();
		}
		catch (IOException e)
		{
			e.printStackTrace();
		}
		catch(IndexOutOfBoundsException e)
		{
			e.printStackTrace();
		}
		catch(NullPointerException e)
		{
			e.printStackTrace();
		}
		finally
		{
			out.close();
			in.close();
		}
	}
}
//Thanks 
//http://javatalks.ru/topics/30791